package light.head.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.Formula;

/**
 * 合同管理 
 */
@Entity
@Table
public class Contract implements Serializable {
	
	
	private static final long serialVersionUID = 4043622413830073359L;
	
	
	private Integer code;
	private String name;					//合同名称
	private Date end;						// 合同到期时间
	private Integer tc;						//合同类别编号
	private Integer cu;						//创建人
	private Date ct;						//创建时间
	private Boolean deleted;				//是否删除
	private Integer uc;						//员工编号
	private String business;				// 单位
	private String uuid;					//路径
	private String ext;						//后缀
	private Integer size;					//大小
	private Integer oc;						//机构编号
	
	//Formula
	private String user;					//员工名称
	private String cuname;					//创建人姓名
	private String tname;					//合同类别名
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public Date getEnd() {
		return end;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Column
	public String getName() {
		return name;
	}
	@Column
	public Integer getTc() {
		return tc;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	@Column
	public Date getCt() {
		return ct;
	}
	@Column
	public Integer getUc() {
		return uc;
	}
	@Column
	public String getBusiness() {
		return business;
	}
	@Column
	public String getUuid() {
		return uuid;
	}
	@Column
	public String getExt() {
		return ext;
	}
	@Column
	public Integer getSize() {
		return size;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = uc)")
	public String getUser() {
		return user;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cu)")
	public String getCuname() {
		return cuname;
	}
	@Formula("(SELECT t.name FROM ContractType t WHERE t.code = tc)")
	public String getTname() {
		return tname;
	}
	
	
	
	
	
	
	
	
	
	
	
	
	public void setBusiness(String business) {
		this.business = business;
	}
	public void setTname(String tname) {
		this.tname = tname;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setCuname(String cuname) {
		this.cuname = cuname;
	}
	public void setUser(String user) {
		this.user = user;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setTc(Integer tc) {
		this.tc = tc;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setUc(Integer uc) {
		this.uc = uc;
	}
	public void setUuid(String uuid) {
		this.uuid = uuid;
	}
	public void setExt(String ext) {
		this.ext = ext;
	}
	public void setSize(Integer size) {
		this.size = size;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setEnd(Date end) {
		this.end = end;
	}

}
